import torch.nn.functional as F

# 在模型中添加Dropout层
model = nn.Sequential(
    nn.Linear(10, 50),
    nn.ReLU(),
    nn.Dropout(p=0.5),  # 丢弃50%的神经元
    nn.Linear(50, 1)
)

# 训练循环与上述示例类似，无需额外修改
